<include file="Public/header" title="警报记录管理"/>

<script src="__STATIC__/laydate/laydate.js"></script>

<style type="text/css">
    html {
        background-color: #E3E3E3;
        font-size: 14px;
        color: #000;
        font-family: '微软雅黑'
    }

    h2 {
        line-height: 30px;
        font-size: 20px;
    }

    a, a:hover {
        text-decoration: none;
    }

    pre {
        font-family: '微软雅黑'
    }

    .box {
        width: 970px;
        padding: 10px 20px;
        background-color: #fff;
        margin: 10px auto;
    }

    .box a {
        padding-right: 20px;
    }

</style>

<div id="page-wrapper">

    <div class="row">
        <div class="col-md-6">
            <form action="{:U('Warn/index')}" method="post">
                <div class="form-group input-group">
                    <div class="col-md-4">
                        <input type="text" readonly="readonly" id="start" class="form-control" name="start_at"
                               placeholder="起始日期">
                    </div>

                    <div class="col-md-4">
                        <input type="text" id="end" readonly="readonly" class="form-control" name="end_at"
                               placeholder="结束日期">
                    </div>

                    <div class="col-md-2">
                        <span class="input-group-btn">
                      <button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
                    </span>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <table class="info-table">
        <thead>
        <tr>
            <th width="10%">嫌疑人</th>
            <th width="50%">人员类型</th>
            <th width="10%">采集人</th>
            <th width="10%">操作</th>
            <th width="20%">警报时间</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="model" item="v">
            <tr>
                <td>
                    {$v.susp_name}
                </td>

                <td>
                    {$v.susp_con}
                </td>

                <td>
                    <span class="text text-info">{$v.cj_name}</span>
                </td>

                <td>
                    <a href="{:U('Index/info?key=')}{$v.susp_id}" style="color:#428BCA;">查看</a> | <a href="##"
                                                                                                     style="color:red;"
                                                                                                     onclick='deleteWarn("{$v.id}")'>删除</a>
                </td>

                <td>
                    {$v.warn_at|date="Y/m/d H:i:s",###}
                </td>

            </tr>
        </foreach>
        </tbody>
    </table>
    <div class="clearfix"></div>
    {$page}

</div>

<script src="__STATIC__/js/dialog-min.js"></script>
<script type="text/javascript">

    function deleteWarn(id) {
        var d = dialog({
            title: '提示',
            width: 200,
            content: '您将删除记录',
            okValue: '确定',
            ok: function () {
                this.title('删除中...');

                $.ajax({
                    url: "{:U('Warn/delete')}",
                    type: 'post',
                    dataType: 'json',
                    timeout: 80000,
                    data: {
                        id: id
                    },
                    success: function (data) {
                        if (data.status) {
                            window.location.reload();
                        }
                        else {
                            this.content('删除失败!');
                        }
                    },
                    error: function () {
                        this.content('删除失败!');
                    }
                });
                return false;
            },
            cancelValue: '取消',
            cancel: function () {
            }
        });
        d.show();
    }

    var start = {
        elem: '#start',
        format: 'YYYY/MM/DD hh:mm:ss',
        min: 0, //设定最小日期为当前日期
        max: laydate.now(), //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };

    var end = {
        elem: '#end',
        format: 'YYYY/MM/DD hh:mm:ss',
        min: laydate.now(),
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };

    laydate(start);
    laydate(end);
</script>
<include file="Public/footer"/>